package com.hhkj.study.admin.resource.excel;

import cn.hutool.core.util.StrUtil;
import com.ruoyi.common.annotation.Excel;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * @Author luowu
 * @Date 2024/9/20 涵 13:33:04
 */
@Data
public class ResourceCourseDocExcelRes extends BaseExcelRes {

    /**
     * 资料名称
     */
    @NotBlank(message = "资料名称不能为空")
    @Excel(name = "资料名称", width = 20, needMerge = true, require = true)
    private String name;

    /**
     * 课程小类,字典表中id
     */
    @NotNull(message = "课程小类不能为空")
    @Excel(name = "课程小类", width = 20, needMerge = true, customDictType = "courseTypeCode", needFilterStr = StrUtil.DASHED, require = true)
    private Long courseType;
    /**
     * 资料类型,字典表中id
     */
    @NotNull(message = "资料类型不能为空或错误")
    @Excel(name = "资料类型", width = 20, needMerge = true, customDictType = "docTypeCode", require = true)
    private Long type;

    /**
     * 年份
     */
    @NotBlank(message = "年份空或者错误")
    @Excel(name = "年份", width = 20, needMerge = true, require = true)
    private String year;

    /**
     * 资料大小(B)
     */
    @Excel(name = "资料大小(B)", width = 20, needMerge = true)
    private Long size;
    /**
     * 讲师id,关联x_teacher表中id
     */
    @NotBlank(message = "讲师为空或者错误")
    @Excel(name = "讲师", width = 20, needMerge = true, require = true)
    private String teacherName;

    private Long teacherId;
    /**
     * 资料url
     */
    @NotBlank(message = "资料url不能为空")
    @Excel(name = "资料url", width = 20, needMerge = true, require = true)
    private String url;

    /**
     * 资料url源文件名
     */
    @NotBlank(message = "源文件名不能为空")
    @Excel(name = "源文件名", width = 20, needMerge = true, require = true)
    private String originFileName;
    /**
     * 下载次数
     */
    private Integer downloadCount;
    /**
     * 备注
     */
    private String remark;
    /**
     * 是否展示（0-上架， 1-下架）
     */
    @Excel(name = "上下架状态", width = 20, needMerge = true, readConverterExp = "0=否,1=是", combo = {"是", "否"})
    private Integer publishedFlag;

    @Override
    public Long getResourceCourseType() {
        return this.courseType;
    }

    @Override
    public String getTitle() {
        return "资料导入模板\n" +
                "1、表头红色加粗为必填字段\n" +
                "2、资料大小默认单位为字节B,如果不填会直接解析url获取";
    }

    @Override
    public String getSheetName() {
        return "资料导入模板";
    }
}
